import { Controller, Get } from '@nestjs/common'
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger'
import { generatePermissions } from '@/utils/formatMenu'
import { PermissionService } from './permission.service'

@Controller('systemManage')
@ApiTags('按钮权限模块')
@ApiBearerAuth()
export class PermissionController {
  constructor(private readonly permissionService: PermissionService) {}

  @Get('allPermissions')
  @ApiOperation({ summary: '获取所有权限' })
  async findAll() {
    const result = await this.permissionService.findAll()
    console.log('result', result)
    return generatePermissions(result)
  }
}
